using System;
using EventManagement_Test.ApplicationEvents;
using EventManagement_Test.Components;
using SharpObjects.EventBus;

namespace BlackboardPattern_Test.Components
{
    public class Component3
    {
                private IEventBus eventBus;

        public Component3()
        {
            this.eventBus = EventBusManager.EventBus;
        }

        public void Run()
        {
            ApplicationEvent1 applicationEvent1a = new ApplicationEvent1() {Id = "instance 1"};
            Console.WriteLine("-----\nPublishing: {0}", applicationEvent1a);
            this.eventBus.Publish(applicationEvent1a);

            ApplicationEvent1 applicationEvent1b = new ApplicationEvent1() { Id = "instance 2" };
            Console.WriteLine("-----\nPublishing: {0}", applicationEvent1b);
            this.eventBus.Publish(applicationEvent1b);

            ApplicationEvent2 applicationEvent2 = new ApplicationEvent2() { Id = "instance 1" };
            Console.WriteLine("-----\nPublishing: {0}", applicationEvent2);
            this.eventBus.Publish(applicationEvent2);

            ApplicationEvent3 applicationEvent3 = new ApplicationEvent3() { Id = "instance 1" };
            Console.WriteLine("-----\nPublishing: {0}", applicationEvent3);
            this.eventBus.Publish(applicationEvent3);
        }
    }
}